﻿using MyStyle.Model;
using MyStyle.Repositry;
using System.Collections;
using System.Collections.Generic;

namespace MyStyle.Service
{
    public class CustomerService : ICustomerService
    {

        private IRepository<Customer> _customerRepository;

        public CustomerService(IRepository<Customer> customerRepository)
        {
            _customerRepository = customerRepository;
        }

        public IEnumerable<Customer> GetAllCustomers()
        {
           return _customerRepository.GetAll();
        }
        public object GetRe()
        {
            return _customerRepository.getRe();
        }
        public Customer GetCustomer(int id)
        {
            return _customerRepository.Get(id);
        }
        public void InsertCustomer(Customer customer)
        {
            _customerRepository.Insert(customer);
        }
        public void UpdateCustomer(Customer customer)
        {
            _customerRepository.Update(customer);
        }
        public void DeleteCustomer(int id)
        {
            Customer customer = GetCustomer(id);
            _customerRepository.Remove(customer);
            _customerRepository.SaveChanges();
        }

    }
}
